<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <script src="js/alert.js"></script>
    <title>消费明细</title>

    <style type="text/css">
        #data {
            padding: 0 5% 0 5%;
        }

        .bean {
            border-bottom: 1px solid #d4d4d4;
            height: 4.8em;
            padding-top: 1em;
        }
    </style>

</head>

<body>

<div id="data">

    <div class="bean">
        <div style="padding-bottom: 3em;">
            <div style="text-align: left;float: left;font-size: 1em;width: 100%;">商品:充电宝</div>
            <div style="text-align: left;float: left;font-size: 1em;width: 50%;">零售价:100</div>
            <div style="text-align: right;float: right;font-size: 1em;">成交价:99</div>
            <div style="text-align: left;float: left;font-size: 1em;width: 100%;">数量:2</div>
        </div>
    </div>

</div>

</body>

<script src="js/jquery.min.js"></script>
<script>
    (function ($) {
        $.getUrlParam1 = function (name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null)
                return decodeURI(r[2]);
            return null;
        }
    })(jQuery);
</script>
<script>
    $(document).ready(function () {
        getdata()
    });

    function getdata() {
        var id = $.getUrlParam1("id");
        $.ajax({
            "url": "/vip/retailrecorditem/",
            "data": "id=" + id,
            "type": "POST",
            "dataType": "json",
            "success": function (json) {
                $("#data").empty();
                var list = json.data;
                for (var i = 0; i < list.length; i++) {
                    var html = '<div class="bean">' +
                        '<div style="padding-bottom: 3em;">' +
                        '<div style="text-align: left;float: left;font-size: 1em;width: 100%;">商品:#{NAME}</div>' +
                        '<div style="text-align: left;float: left;font-size: 1em;width: 50%;">零售价:#{ORIGINAL}</div>' +
                        '<div style="text-align: right;float: right;font-size: 1em;">成交价:#{SELLING}</div>' +
                        '<div style="text-align: left;float: left;font-size: 1em;width: 100%;">数量:#{QTY}</div>' +
                        '</div>' +
                        '</div>';

                    html = html.replace("#{ID}", list[i].id);
                    html = html.replace("#{NAME}", list[i].name);
                    html = html.replace("#{CODE}", list[i].code);
                    html = html.replace("#{ORIGINAL}", list[i].original);
                    html = html.replace("#{SELLING}", list[i].selling);
                    html = html.replace("#{QTY}", list[i].qty);
                    $("#data").append(html);
                }

            }
        })
    }

</script>
</html>